<template>
	<view class="ordeVehicle">
		<u-navbar title="订单详情" title-color="#333" back-icon-color="#333"></u-navbar>
		<view class="page-box" v-if="orderList.length!='0'">
			<view class="order" v-for="(res, index) in orderList" :key="index">
				<view class="top">
					<view class="left">
						<view class="store">派单时间：{{ res.ORMTB440CA19||'' }}</view>
					</view>
					<!-- <view class="right" @click="detiles(res)">详情</view> -->
				</view>
				<view class="item">
					<view class="left">
						<u-icon name="car-fill" size="58" color="#ccc"></u-icon>
						<view class="license_plate">{{ res.ORMTB440CA01 }}</view>
					</view>
					<view class="content">
						<view class="title u-line-2">{{ res.ORMTB440CA24 }}</view>
						<view class="type">{{ res.ORMTB440CA03 }}</view>
						<view class="type">
							<text style="margin-right: 15px;">{{ res.ORMTB440CA07 }}</text>
							<text>{{ res.ORMTB440CA10 }}{{'吨'}}</text>
						</view>
						<view class="">
							{{ res.ORMTB440CF01text||'' }}
						</view>
					</view>
				</view>
				<view class="an-rig-fix">
					<view class="">
						<u-button @click="tabquerycode(res)" type="primary" class="btn_mid stybutdd">选择订单</u-button>
					</view>
				</view>
				
			</view>
		</view>
		<!-- <view class="sendorder-loadmore">
			<u-loadmore v-if="orderList.length!=0" :status="status" :icon-type="iconType" :load-text="loadText" />
		</view> -->
		<view class="zanWSJ" v-if="orderList.length=='0'">
			<image :src="getStaticFilePath('/QXY/noData.png')" alt="">
		</view>
	</view>
</template>

<script>
	import md5 from '../../util/MD5.js'
	export default {
		data() {
			return {
				screeningshow: false,
				codeShow: false,
				type: '', // 1 派单时间 2 结算时间
				//订单列表
				orderList: [],
				brightness: null,
				current: 1, // tabs组件的current值，表示当前活动的tab选项
				swiperCurrent: 0, // swiper组件的current值，表示当前那个swiper-item是活动的
				list: [{
						name: '全部'
					},
					{
						name: '待接单'
					},
					{
						name: '待提货'
					},
					{
						name: '提货中',
					},
					{
						name: '已完成',
					},
					{
						name: '已回执',
					},
					{
						name: '确认回执',
					},
					{
						name: '已取消',
					},
					{
						name: '待审核',
					}
				],
				status: 'loading',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				countpage: 1,
				page: 1,
				userinfo: JSON.parse(uni.getStorageSync('userinfo')),
				dataStatisCount: [],
				totalWeight: 0,
				totalAmount: 0,
				totalCarCount: 0,
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true
				},
				year: '',
				systemInfo: uni.getSystemInfoSync(),
				navHeight: '',
				optionHeight: 35,
				enterpriseName: '全部',
				erpshow: false,
				erpId: '',
				erpcColumns: [],
				stattimeshow: false,
				endtimeshow: false,
				dateStartStr: '',
				dateEndStr: '',
				materName: '全部',
				matershow: false,
				materColumns: [],
				materId: '',
				carshow: false,
				carNumberName: '全部车牌号',
				carkeyword: '',
				carKeyWordshow: false,
				carList: [],
				binary: '',
				ordercoutObj: '',
				AuthorizationOBJ: '',
				queryCodeList: '',
				mydata: {
					binary: '',
					txbinary:'',
					queryCodeList: ''
				}
			};
		},
		onLoad() {
			this.querycodeList()
		},

		methods: {
			tabquerycode(item) {
				// console.log(item)
				const tim = new Date().valueOf() // 方法一
				var key = '25ee70b9f3354703647a437e491c0ac7' + tim + 'hf&*/*6'
				var p1 = md5.hex_md5(key)
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/orm/ormtb440/getErwei',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB400CA03: this.userinfo.ORMTB400CA03,
						ORMTB440CA23: item.ORMTB440CA23,
						ORMTB440ID: item.ORMTB440ID,
						key:p1,
						time:tim
					},
					success: (res) => {
						console.log(res);
						uni.hideLoading();
						if (res.data.code == 200) {
							var data = res.data.data
							
						console.log(data)
							// if(data.txm =='1'){
							// 	this.txbinary = 'data:image/png;base64,' + data.ORMTB440CA22
							// }
							// else{
							// 	this.binary = 'data:image/png;base64,' + data.ORMTB440CA22
							// }
							// this.queryCodeList = data
							uni.$emit('updateData', data)
							uni.navigateBack({
								delta: 1
							})

						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
					},
					fail: (res) => {
						console.log(res)
						uni.hideLoading();
						this.$refs.uToast.show({
							title: res.errMsg,
							type: 'default',
							icon: false
						})
					}
				});

			},
			querycodeList() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				this.binary = ''
				uni.request({
					url: this.baseUrl + '/orm/ormtb440/selectQRCodeList',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB410ID: this.userinfo.ORMTB410ID, //二级客户ID
						ORMTB410CA02: this.userinfo.ORMTB410CA02
					},
					success: (res) => {
						console.log(res);
						uni.hideLoading();
						if (res.data.code == 200) {
							var data = res.data.data
							this.orderList = data
						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
					},
					fail: (res) => {
						console.log(res)
						uni.hideLoading();
						this.$refs.uToast.show({
							title: res.errMsg,
							type: 'default',
							icon: false
						})
					}
				});

			}
		}
	}
</script>

<style lang="scss" scoped>
	.ordeVehicle {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
		background-color: #E3E3E3;
	}

	.zanWSJ {
		padding-top: 200rpx;
	}

	.zanWSJ>image {
		display: block;
		margin: 0 auto;
		height: 360rpx;
		width: 43%;
	}

	.order {
		width: 710rpx;
		background-color: #ffffff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 40rpx 20rpx;
		font-size: 28rpx;

		.top {
			display: flex;
			justify-content: space-between;
			border-bottom-width: 1rpx;
			border-bottom-color: #eee;
			border-bottom-style: solid;
			padding-bottom: 20rpx;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin: 0 10rpx;
					font-size: 32rpx;
					color: #666;
				}
			}

			.right {
				color: #058cff;
			}
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				// margin-top: 30rpx;
				margin-right: 30rpx;
				text-align: center;

				.license_plate {
					// width: 130rpx;
					text-align: center;
					font-size: 30rpx;
					margin-top: 10rpx;
				}
			}

			.content {
				.title {
					font-size: 32rpx;
					line-height: 50rpx;
				}

				.type {
					margin: 10rpx 0;
					font-size: 32rpx;
					color: #303133;
				}

				.btn_mid {
					margin-left: 330rpx;
					margin-top: -30rpx;
					padding: 0rpx 25rpx;
					height: 70rpx;
					width: 180rpx;
					top: 30rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			display: flex;
			margin-top: 40rpx;
			padding: 0 10rpx;
			justify-content: space-between;
			align-items: center;

			.btn {
				line-height: 52rpx;
				width: 160rpx;
				border-radius: 26rpx;
				border: 2rpx solid $u-border-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-type-info-dark;
			}

			.evaluate {
				color: $u-type-warning-dark;
				border-color: $u-type-warning-dark;
			}
		}
	}
	.an-rig-fix{
		display: flex;
		justify-content:flex-end;
	}
	.stybutdd {
		height: 70rpx;
		width: 180rpx;
	}
</style>
